package com.ys.service.sys;

import java.util.List;
import java.util.Map;

import org.springframework.ui.Model;

import com.bo.vo.R;
import com.ys.dto.DtreeSqlDto;

import lombok.AllArgsConstructor;
import lombok.Data;

public interface YsRoleService {
	
	R add(Map<String, Object> params);

	R edit(Long id, Map<String, Object> params);
	
	String toAuth(Model model, Long roleId);
	@Data
	@AllArgsConstructor
	public class ToAuthDto{
		private Long roleId;
	}

	DtreeSqlDto dtreeForAuth(Long roleId);

	R listForAuth(Long roleId, Long menuId);
	@Data
	@AllArgsConstructor
	public class ToListForAuthDto{
		private List<MenuDto> menuArr;
		
		@Data
		@AllArgsConstructor
		public static class MenuDto{
			private Long id;
			private String name;
			private boolean isSelected;
			private List<ButtonDto> buttonArr;
			private Integer type;
			
			@Data
			@AllArgsConstructor
			public static class ButtonDto{
				private Long id;
				private String name;
				private boolean isSelected;
			}
		}
	}

	R saveAuth(Long roleId, String menuArr);

	R addRoleMenu(Long roleId, Long menuId, Integer type);

	R cancelRoleMenu(Long roleId, Long menuId);

	R changeAuthMenuType(Long roleId, Long menuId, Integer type);

	R addRoleButton(Long roleId, Long buttonId);

	R cancelRoleButton(Long roleId, Long buttonId);
}
